package com.hllxd.hism.star.basic.service.service;


import com.alibaba.fastjson.JSON;
import com.hllxd.hism.star.basic.service.dao.mapper.mis.ProjectMapper;
import com.hllxd.hism.star.basic.service.model.ProjectEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 跳房子订单实现类
 *
 * @author xiyong.lxy
 * @date 2020/12/20 16:15
 */
@Slf4j
@Service("projectService")
public class ProjectServiceImpl implements ProjectService {

    @Autowired
    private ProjectMapper clusterMapper;

    @Override public List<ProjectEntity> listProject() {
        return clusterMapper.listProject();
    }

    @Override public ProjectEntity getProject(Long id) {
        return clusterMapper.getProject(id);
    }

    @Override public Long addProject(ProjectEntity entity) {
        log.info("set param: {}", JSON.toJSONString(entity));
        if(entity.id==null || entity.id==0) {
            return clusterMapper.insertProject(entity);
        } else {
            return clusterMapper.updateProject(entity);
        }
    }

    @Override public Boolean deleteProject(String ids) {
        return clusterMapper.deleteProject(ids);
    }
}
